
export function genStore() {
  const module = import.meta.glob('/src/**/*-store.ts', { eager: true })
  const obj = {};
  Object.keys(module).forEach((item) => {
    const name = item.match(/(?<=\/)[a-zA-Z]+(?=\-)/g)![0]
    const content = (module[item] as any).default ;
    if (!content) {
      throw new Error('Please export default in ' + item)
    }
    Object.assign(obj, { [name]: content })
  });
  return obj;
}

export function genPageCodeGenerator() {
  const module = import.meta.glob('/src/**/*-generator.ts', { eager: true })
  const obj = {};
  Object.keys(module).forEach((item) => {
    const name = item.match(/(?<=\/)[a-zA-Z0-9]+(?=\-)/g)![0]
    const content = (module[item] as any).default ;
    if (!content) {
      throw new Error('Please export default in ' + item)
    }
    Object.assign(obj, { [name]: content })
  });
  return obj;
}
